import baseUrl from './baseUrl'

let token=uni.getStorageSync('userinfo').token;

console.log(token,'@@@@@@@@@@@2');
let http=(obj)=>{
	return new Promise((resolve,reject)=>{
		uni.request({
			url:baseUrl+"/api"+obj.url,
			method:obj.method||"get",
			data:obj.data||{},
			header:token?{authorization:token}:{
				"content-type":"application/json"
			},
			success(res){
				resolve(res)
			},
			fail(err){
				reject(err)
			}
		})
	})
}
export default http